package com.biubiu.biubiuexam.nosql.repository;

import com.biubiu.biubiuexam.nosql.model.ExamResponse;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * The interface Exam response repository.
 */
public interface ExamResponseRepository extends MongoRepository<ExamResponse, String> {
    /**
     * Find exam response by id exam response.
     *
     * @param id the id
     * @return the exam response
     */
    ExamResponse findExamResponseById(String id);

    /**
     * Find exam response by student id exam response.
     *
     * @param studentId the student id
     * @return the exam response
     */
    ExamResponse findExamResponseByStudentId(long studentId);

    /**
     * Find all by exam id list.
     *
     * @param id the id
     * @return the list
     */
    @Query("{examId:'?0'}")
    List<ExamResponse> findAllByExamId(String id);

    long count();

}
